import 'babel-polyfill'
import Vue from 'vue'
import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import router from './router'
import store from './store'

import i18n from './lang' // Internationalization
import './icons' // icon
import './permission' // permission
import _ from 'lodash'
Vue.prototype._ = _

import * as filters from './filters' // global filters

// import global_ from './common/js/common'

const VueUploadComponent = require('vue-upload-component')
Vue.component('file-upload', VueUploadComponent)

Vue.use(Element, {
  size: Cookies.get('size') || 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
})

// 此处只有两个API,全局导入API
import apiIndex from './api/index.js'
Vue.prototype.searchListAll = apiIndex.searchListAll
Vue.prototype.saveNewMediaAll = apiIndex.saveNewMediaAll
Vue.prototype.deleteNewMediaAll = apiIndex.deleteNewMediaAll
// 全局变量
import common from './api/common'
Vue.prototype.GLOBAL = common
// 全局混入
import mixin from './mixins/index.js'
Vue.mixin(mixin)

Vue.config.productionTip = false
// register global utility filters.
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
// store.dispatch('setLanguage', 'zh')

// Vue.prototype.GLOBAL = global_
// Vue.prototype.IMAGEURL = 'http://youyi.52ruijiajia.com'

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
